package LambdaDemo;

import NicknameInnerClassProject.Student;

import java.util.Arrays;

public class LambdaDemo2 {
    public static void main(String[] args) {
        Student[] students = new NicknameInnerClassProject.Student[6];
        students[0] = new NicknameInnerClassProject.Student("小王", 18, 170, '男');
        students[1] = new NicknameInnerClassProject.Student("小张", 19, 180, '女');
        students[2] = new NicknameInnerClassProject.Student("小李", 17, 160, '男');
        students[3] = new NicknameInnerClassProject.Student("小赵", 16, 150, '男');
        students[4] = new NicknameInnerClassProject.Student("小孙", 17, 170, '女');
        students[5] = new Student("小周", 18, 170, '女');

        Arrays.sort(students, (Student o1,Student o2) -> {
            return o1.getAge() - o2.getAge();
        });

        for (Student student : students)
            System.out.println(student);
    }
}
